Visitor-Oriented Programming
نویسندگان
چکیده
Multiple dispatching and the visitor pattern are approaches to making object-oriented programs more extensible. Both have a flavor of pattern matching, thereby moving objectoriented programming closer to functional programming. The key idea of these approaches can be crystallized as a notion of visitor which lies between functions and objects. Can this idea be developed into a new form of visitor-oriented programming which combines the best of functional and object-oriented programming? As a first step, we present a visitor calculus in which each value is a visitor and every visitor call uses double dispatching. We illustrate the relationships to other paradigms by translating the lambdacalculus to the visitor calculus, and the visitor calculus to Java. Our calculus forms the core of a language in which we have programmed the translation of the lambda-calculus to the visitor calculus itself. To demonstrate the expressiveness of visitors, we show the translation in four versions that use smaller and smaller subsets of the language. Along the way, we present correctness proofs and examples of running an implementation of our language.
منابع مشابه
Functional Visitors Revisited
In object-oriented programming the visitor design pattern allows for the addition of new operations on a data hierarchy, but lends itself to scattered traversal code and makes visitors difficult to combine. Previous attempts to solve these issues have separated traversal code from the data structure but still face a lack of modularity in visitor computation making it difficult– if not impossibl...
متن کاملUsing Aspect-Oriented Programming for Design Patterns Implementation
Object-oriented design patterns are useful for designing software programs or components, which are based on objects. Object-orientation has however some limitations that a more recent approach known as aspectorientation, or more generally as "advanced separation of concerns" try to eliminate. This paper presents and motivates the beginning of some work aiming to identify and gain from the bene...
متن کاملAspect-Oriented Design and Implementation of a Java Bytecode Analyzer Framework
We propose a new type of Java bytecode analyzer framework based on aspect-oriented design and programming. We also observe that aspect-oriented design and programming improve separation of concerns of many of the characteristics of the design, including extensibility, type safety, and execution efficiency of its design and implementation, when compared to existing analyzer frameworks based on o...
متن کاملStatically-Scoped Exceptions: a Typed Foundation for Aspect-Oriented Error Handling
Aspect-oriented programming systems such as AspectJ provide mechanisms for modularizing crosscutting error-handling concerns. However, AspectJ’s advice does not integrate well with Java’s checked exception mechanism. Furthermore, conventional exception-handling facilities such as AspectJ’s share the problem of accidental exception capture due to the dynamic nature of exception-handling semantic...
متن کاملThe Essence of the Visitor Pattern
For object-oriented programming, the Visitor pattern enables the definition of a new operation on an object structure without changing the classes of the objects. The price has been that the set of classes must be fixed in advance, and they must each have a so-called accept method. In this paper we demonstrate how to program visitors without relying on accept methods and without knowing all cla...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2003